﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Stack
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }

    class MyStack
    {
        
        private List<object> stackVal = new List<object>();


        public void Push(object obj)
        {
            stackVal.Add(obj);
        }

        public object Pop ()
        {
            if ((stackVal.Count - 1) < 0)
            {
                Console.WriteLine("List should not be empty");
                return null;
            }

            else
            {
                object returnValue = stackVal[stackVal.Count - 1];
                Console.WriteLine("Stack element: {0}",returnValue);
                stackVal.RemoveAt(stackVal.Count - 1);
                return returnValue;
            }
            
        }
      
        public void Clear ()
        {
            stackVal.Clear();
        }
    }
}
